package cn.com.cifi.mars.listener;

import cn.com.cifi.mars.common.enums.LocalCommandEnum;
import cn.com.cifi.mars.service.DmDmRemovalReportService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class RedisCommandListener{

    @Autowired
    private DmDmRemovalReportService dmDmRemovalReportService;

    public void onMessage(String command) {
        String extCommand = command.replace("\"", "");
        log.info("RedisCommand获得消息：{}",extCommand);
        LocalCommandEnum localCommandEnum = LocalCommandEnum.getByCode(extCommand);
        if (localCommandEnum != null){
            dmDmRemovalReportService.sendCommand(localCommandEnum);
        }

    }
}
